<%@ page contentType="text/html;charset=UTF-8" language="java" import="java.util.*" pageEncoding="utf-8" %>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib prefix="html" uri="http://jakarta.apache.org/struts/tags-html" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%
    request.setCharacterEncoding("utf-8");
    response.setCharacterEncoding("utf-8");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>

<head>
    <base href="<%=basePath%>"></base>
    <title>${sessionScope.topicName} - 舆情信息系统</title>
    <link rel="stylesheet" type="text/css" href="css/mainPageStyle.css"/>
    <link rel="stylesheet" href="css/pagination.css"/>
    <link rel="stylesheet" href="css/subPage.css"/>
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/jquery.pagination.js"></script>
    <%@include file="../im.jsp" %>
</head>


<body>
    <logic:notEmpty name="user">
        <div id="content" class="container">
            <%@include file="../top.jsp" %>
            <div class="row">
                <%@include file="../left.jsp" %>



                <div class="col-md-10">
                    <div id="right_left">
                        <html:form action="keywordAction.do?method=insert" method="post">
                            <table>
                                <tr>
                                    <td colspan="2">
                                        添加负面关键词
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        关键词
                                    </td>
                                    <td>
                                        <html:text onfocus="clearErrorInfo();" onblur="return validateName()" name="keyword"
                                                   property="keyword" value=""></html:text>
                                        <span id="keyword_info" style="color: red;"></span>
                                    </td>
                                </tr>


                                    <tr>
                                        <td>
                                            负面级别
                                        </td>
                                        <td>
                                            <html:text property="importance" value=""></html:text>
                                            （1到10的范围内，数值越大，越重要）
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            负面词类别
                                        </td>
                                        <td>
                                            <html:text property="category" value=""></html:text>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <html:submit property="submit" value="添加"></html:submit>
                                        </td>
                                        <td>
                                            <html:reset property="cancel" value="重置"></html:reset>
                                        </td
                                    </tr>
                                </table>
                            </html:form>
                            <a href="keywordAction.do?method=show">返回</a>
                        </div>
                        <script type="text/javascript">
                            function validateName(){
                                var keyword = $("#right_left input[name=keyword]").val();
                                if(keyword==null||keyword==""){
                                    $("span#keyword_info").text("关键词不能为空!");
                                    $("#right_left input[name=keyword]").focus();
                                    return false;
                                }
                                return true;
                            }
                            function clearErrorInfo(){
                                $("span#keyword_info").text("");
                            }
                        </script>
                    </div>


        </div>
    </logic:notEmpty>
    <logic:empty name="user">
    Access Rejected! Error 404
    </logic:empty>
</body>
</html>

